<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: xiao
  Date: 2020/10/28
  Time: 16:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>书籍展示页面</title>
    <%--    Boostrap美化--%>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 columm">
            <div class="page-header">

                <h1><span class="label label-default">图书列表</span></h1>
            </div>
        </div>
        <div class="row">
            <div class="col-md-8 column">


                <a class="btn btn-primary" href="${pageContext.request.contextPath}/book/findAll">显示全部书籍</a>
            </div>
            <div class="col-md-4 column">
                <div class="col-md-4 column"></div>
                <div class="col-md-12 column">

                    <%--查询书籍--%>
                    <form class="form-inline" action="${pageContext.request.contextPath}/book/queryBook" method="post"
                          style="float: right">

                        <input type="text" name="queryBookName" class="form-control" placeholder="请输入要查询的书籍名称">
                        <input type="submit" value="查询" class="btn btn-primary">
                        <p style="color: red;font-weight: bold">${error}</p>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>书籍编号</th>
                    <th>书籍名称</th>
                    <th>书籍数量</th>
                    <th>书籍详情</th>
                    <th>书籍图片</th>
                    <th>操作</th>
                </tr>
                </thead>
                <%--               书籍从数据库查询出来，从这个list遍历出来--%>

                <tbody>
                <c:forEach var="book" items="${pageInfo.list}">
                    <tr>
                        <td>${book.bookID}</td>
                        <td>${book.bookName}</td>
                        <td>${book.bookCounts}</td>
                        <td>${book.detail}</td>
                        <td><img  style="width: 200px;height: 200px" src="${pageContext.request.contextPath}/img/${book.pic}"></td>
                        <td>   <a  href="${pageContext.request.contextPath}/book/borrow?id=${book.bookID}"><button class="btn btn-info">借阅</button></a></td>

                    </tr>
                </c:forEach>
                <tr><span style="color: red;font-weight: bold">${exit}</span></tr>
                </tbody>

            </table>


        </div>
    </div>
</div>
<h1></h1>
</body>
</html>
